package com.patterns.memento;

/**
 * 备忘录类
 * 负责存储Student的内部状态，并防止Student以外的其它对象访问
 * @author huangke
 *
 */
public class StudentMemento {
	//被保存源发器的状态
	private String name;
	private int age;
	
	//构造传入源发器类，防止其它对象访问
	public StudentMemento(Student student){
		this.name = student.getName();
		this.age = student.getAge();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}
}
